home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / textured-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  6.4 KB  |  174 lines

  1. ;  BLENDED-DROP-SHADOW-LOGO
  2. ;  draw the specified text over a blended background using current gimp fg
  3. ;   and bg colors.  The finished blend has a drop shadow underneath that blends
  4. ;   to the specified bg-color
  5. ;  if the blend colors are specified as high intensity, the sharp option
  6. ;   should be enabled or the logo will come out blurry
  7.  
  8. (define (scale size percent) (* size percent))
  9.  
  10. (define (apply-textured-logo-effect img
  11.                     logo-layer
  12.                     b-size
  13.                     text-pattern
  14.                     tile-type
  15.                     bg-color
  16.                     blend-fg
  17.                     blend-bg)
  18.   (let* ((b-size-2 (scale b-size 0.5))
  19.      (f-size (scale b-size 0.75))
  20.      (ds-size (scale b-size 0.5))
  21.      (ts-size (- b-size-2 3))
  22.      (width (car (gimp-drawable-width logo-layer)))
  23.      (height (car (gimp-drawable-height logo-layer)))
  24.      (blend-layer (car (gimp-layer-new img width height RGBA-IMAGE
  25.                        "Blend" 100 NORMAL-MODE)))
  26.      (shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE
  27.                         "Shadow" 100 NORMAL-MODE)))
  28.      (text-shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE
  29.                          "Text Shadow" 100 MULTIPLY-MODE)))
  30.      (tsl-layer-mask (car (gimp-layer-create-mask text-shadow-layer
  31.                               ADD-BLACK-MASK)))
  32.      (drop-shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE
  33.                          "Drop Shadow" 100 MULTIPLY-MODE)))
  34.      (dsl-layer-mask (car (gimp-layer-create-mask drop-shadow-layer
  35.                               ADD-BLACK-MASK))))
  36.  
  37.     (gimp-context-push)
  38.  
  39.     (script-fu-util-image-resize-from-layer img logo-layer)
  40.     (gimp-image-add-layer img shadow-layer 1)
  41.     (gimp-image-add-layer img blend-layer 1)
  42.     (gimp-image-add-layer img drop-shadow-layer 1)
  43.     (gimp-image-add-layer img text-shadow-layer 0)
  44.     (gimp-selection-all img)
  45.     (gimp-context-set-pattern text-pattern)
  46.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  47.     (gimp-edit-bucket-fill logo-layer PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  48.     (gimp-selection-none img)
  49.     (gimp-edit-clear text-shadow-layer)
  50.     (gimp-edit-clear drop-shadow-layer)
  51.     (gimp-context-set-background bg-color)
  52.     (gimp-drawable-fill shadow-layer BACKGROUND-FILL)
  53.     (gimp-rect-select img b-size-2 b-size-2 (- width b-size) (- height b-size)
  54.               CHANNEL-OP-REPLACE TRUE b-size-2)
  55.     (gimp-context-set-background '(0 0 0))
  56.     (gimp-edit-fill shadow-layer BACKGROUND-FILL)
  57.     (gimp-selection-layer-alpha logo-layer)
  58.     (gimp-layer-add-mask text-shadow-layer tsl-layer-mask)
  59.     (gimp-context-set-background '(255 255 255))
  60.     (gimp-edit-fill tsl-layer-mask BACKGROUND-FILL)
  61.     (gimp-selection-feather img f-size)
  62.     (gimp-context-set-background '(63 63 63))
  63.     (gimp-edit-fill drop-shadow-layer BACKGROUND-FILL)
  64.     (gimp-context-set-background '(0 0 0))
  65.     (gimp-edit-fill text-shadow-layer BACKGROUND-FILL)
  66.     (gimp-context-set-foreground '(255 255 255))
  67.  
  68.     (gimp-edit-blend text-shadow-layer FG-BG-RGB-MODE NORMAL-MODE
  69.              GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
  70.              FALSE 0 0 TRUE
  71.              0 0 1 1)
  72.  
  73.     (gimp-selection-none img)
  74.     (gimp-context-set-foreground blend-fg)
  75.     (gimp-context-set-background blend-bg)
  76.  
  77.     (gimp-edit-blend blend-layer FG-BG-RGB-MODE NORMAL-MODE
  78.              GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
  79.              FALSE 0 0 TRUE
  80.              0 0 width 0)
  81.  
  82.     (plug-in-mosaic 1 img blend-layer 12 1 1 0.7 TRUE 135 0.2 TRUE FALSE
  83.             tile-type 1 0)
  84.  
  85.     (gimp-layer-translate logo-layer (- b-size-2) (- b-size-2))
  86.     (gimp-layer-translate blend-layer (- b-size) (- b-size))
  87.     (gimp-layer-translate text-shadow-layer (- ts-size) (- ts-size))
  88.     (gimp-layer-translate drop-shadow-layer ds-size ds-size)
  89.     (gimp-selection-layer-alpha blend-layer)
  90.     (gimp-layer-add-mask drop-shadow-layer dsl-layer-mask)
  91.     (gimp-context-set-background '(255 255 255))
  92.     (gimp-edit-fill dsl-layer-mask BACKGROUND-FILL)
  93.     (gimp-layer-remove-mask drop-shadow-layer MASK-APPLY)
  94.     (gimp-selection-none img)
  95.  
  96.     (gimp-context-pop)))
  97.  
  98. (define (script-fu-textured-logo-alpha img
  99.                        logo-layer
  100.                        b-size
  101.                        text-pattern
  102.                        tile-type
  103.                        bg-color
  104.                        blend-fg
  105.                        blend-bg)
  106.   (begin
  107.     (gimp-image-undo-group-start img)
  108.     (apply-textured-logo-effect img logo-layer b-size text-pattern tile-type
  109.                 bg-color blend-fg blend-bg)
  110.     (gimp-image-undo-group-end img)
  111.     (gimp-displays-flush)))
  112.  
  113. (script-fu-register "script-fu-textured-logo-alpha"
  114.             _"_Textured..."
  115.             "Creates textured logos with blended backgrounds, highlights, and shadows"
  116.             "Spencer Kimball"
  117.             "Spencer Kimball"
  118.             "1996"
  119.             "RGBA"
  120.                     SF-IMAGE      "Image"                 0
  121.                     SF-DRAWABLE   "Drawable"              0
  122.             SF-ADJUSTMENT _"Border size (pixels)" '(20 1 100 1 10 0 1)
  123.             SF-PATTERN    _"Pattern"              "Fibers"
  124.             SF-OPTION     _"Mosaic tile type"     '(_"Squares"
  125.                                 _"Hexagons"
  126.                                 _"Octagons")
  127.             SF-COLOR      _"Background color"     '(255 255 255)
  128.             SF-COLOR      _"Starting blend"       '(32 106 0)
  129.             SF-COLOR      _"Ending blend"         '(0 0 106))
  130.  
  131. (script-fu-menu-register "script-fu-textured-logo-alpha"
  132.              _"<Image>/Script-Fu/Alpha to Logo")
  133.  
  134.  
  135. (define (script-fu-textured-logo text
  136.                  size
  137.                  fontname
  138.                  text-pattern
  139.                  tile-type
  140.                  bg-color
  141.                  blend-fg
  142.                  blend-bg)
  143.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  144.      (b-size (scale size 0.1))
  145.      (text-layer (car (gimp-text-fontname img -1 0 0 text b-size
  146.                           TRUE size PIXELS fontname))))
  147.     (gimp-image-undo-disable img)
  148.     (gimp-drawable-set-name text-layer text)
  149.     (apply-textured-logo-effect img text-layer b-size text-pattern tile-type
  150.                 bg-color blend-fg blend-bg)
  151.     (gimp-image-undo-enable img)
  152.     (gimp-display-new img)))
  153.  
  154. (script-fu-register "script-fu-textured-logo"
  155.             _"_Textured..."
  156.             "Creates textured logos with blended backgrounds, highlights, and shadows"
  157.             "Spencer Kimball"
  158.             "Spencer Kimball"
  159.             "1996"
  160.             ""
  161.             SF-STRING     _"Text"               "The GIMP"
  162.             SF-ADJUSTMENT _"Font size (pixels)" '(200 1 1000 1 10 0 1)
  163.             SF-FONT       _"Font"               "CuneiFont"
  164.             SF-PATTERN    _"Text pattern"       "Fibers"
  165.             SF-OPTION     _"Mosaic tile type"   '(_"Squares"
  166.                                _"Hexagons"
  167.                                _"Octagons")
  168.             SF-COLOR      _"Background color"   '(255 255 255)
  169.             SF-COLOR      _"Starting blend"     '(32 106 0)
  170.             SF-COLOR      _"Ending blend"       '(0 0 106))
  171.  
  172. (script-fu-menu-register "script-fu-textured-logo"
  173.              _"<Toolbox>/Xtns/Script-Fu/Logos")
  174.